import BaseController from '../../core/controllers/Base.controller';

@Inject('$log', '$rootScope', '$state', 'noticeService', 'ngDialogService')
class NoticeDetailController extends BaseController {
  constructor() {
    super();

    const noticeId = $state.params.id;
    this.announcementInfo = {
      title: '',
      context: '',
      attachmentIds: [],
      unit: '1',
    };
    this.$getDetailInfo(noticeId);
  }

  $getDetailInfo(noticeId) {
    this.noticeService
      .get({ id: noticeId })
      .then((res) => {
        if (res.success) {
          this.noticeDetailInfo = res.data;
        } else {
          this.ngDialogService.alertError(res.message);
        }
      });
  }
}

export default NoticeDetailController;
